//
//  XLMainTabBarController.swift
//  WeiBo
//
//  Created by macbook on 16/10/17.
//  Copyright © 2016年 buWangChuXing. All rights reserved.
//

import UIKit

class XLMainTabBarController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()

        view.backgroundColor = UIColor.whiteColor()
        //自定义tabbar
        let tabBar = XLTabBar()
        tabBar.XLDelagate = self
        
        setValue(tabBar, forKey: "tabBar");
        
       childViewControllers(XLHomeViewController(), title: "首页", imageName: "tabbar_home")
        childViewControllers(XLMessageViewController(), title: "消息", imageName: "tabbar_message_center")
        childViewControllers(XLDiscoverViewController(), title: "发现", imageName: "tabbar_discover")
        childViewControllers(XLProfileViewController(), title: "我", imageName: "tabbar_profile")
        
    }
    
    
    func childViewControllers(vc:UIViewController,title:String,imageName:String)
    {
        vc.title = title;
        vc.tabBarItem.image = UIImage(named: imageName)
        vc.tabBarItem.selectedImage = UIImage(named: "\(imageName)_selected")
        let navc = UINavigationController(rootViewController: vc)
        addChildViewController(navc)
        
   }
}

extension XLMainTabBarController:XLTabBarDelegate
{
    func composeBtnClickPushController() {
        
        print("弹出控制器")
    }
}







